package snafu.framework.agents;

import snafu.framework.actions.Intention;
import snafu.framework.actions.IntentionItself;
import snafu.framework.objects.WorldObject;
import snafu.framework.states.literals.StateLiteral;
import snafu.framework.states.literals.StateLiteralItself;

public class ReactingAgent extends AgentItself {

	/**
	 * The initiator of the reaction.
	 */
	private WorldObject initiator;
	
	/**
	 * Instantiates a new reacting agent. To only purpose of this agent is to be put as the
	 * initiator of a reaction.
	 * 
	 * @param initiator
	 *            the object that initiated a reaction
	 * @param intention
	 *            the intention that created the reaction
	 */
	public ReactingAgent(WorldObject initiator, Intention<?> intention) {
		super(null);
		this.initiator = initiator;
		// copy the 
		for (StateLiteral<?> literal : initiator.getState().getLiterals()) {
			state.addLiteral((StateLiteralItself<?>) literal);
		}
		
		state.addIntention((IntentionItself<?>) intention);
	}
	
	@Override
	public String toString() {
		return initiator.toString();
	}
	
}
